import java.util.Timer;
import java.util.TimerTask;
import java.io.File;
import java.io.FileWriter;

//import pkugrad.LocateCluster; //LocateCluster is ur clustering method

public class ClusterDaemon{
	
	static class Clustering extends TimerTask{
		public void run(){
			try{
				//File fh = new File("D:\\recorder.txt");
				FileWriter fw = new FileWriter("D:\\recorder.txt",true);
				fw.write(String.valueOf(System.currentTimeMillis())+'\n');
				fw.flush();
				System.out.println(" vive la pku");
			} catch(Exception e){}
		}
	}
	
	public static void main(String[] args){
		Timer timer = new Timer(); //Timer(true) as daemon, cannot keep alive solely
		timer.scheduleAtFixedRate(new Clustering(),2000,2000); //every 2 sec
	}
}